package design.mode.effective_java.chapter2.item5;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * 依赖注入的方式提供灵活性和可测性
 *
 * @author ZhongMingde on 2021/8/3
 */

public class SpellChecker2 {
    private final Lexicon dictionary;

    public SpellChecker2(Lexicon dictionary) {
        //  Objects.requireNonNull 检查指定的对象引用不是 null 。
        this.dictionary = Objects.requireNonNull(dictionary);
    }

    public static boolean isValid(String word) {
        return false;
    }

    public static List<String> suggestions(String typo) {
        return new ArrayList<>();
    }

}
